﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Ks.Fs.Entity;

namespace Ks.FileStreaming
{    
    [ServiceContract]
    public interface IStreamingService
    {
        //upload, download 
        /// <summary>
        /// download a file
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        [OperationContract]
        RemoteFileInfo DownloadFile(DownloadRequest filename);

        /// <summary>
        /// Upload a file 
        /// </summary>
        /// <param name="request"></param>
        [OperationContract]
        UploadedFileInfo UploadFile(RemoteFileInfo request);
                         
        /// <summary>
        /// moving file to specific folder
        /// </summary>
        /// <param name="fileId">int</param>
        /// <param name="toFolderId">int</param>
        /// <returns></returns>
        [OperationContract]
        bool Move(int fileId, int toFolderId);     
                
        /// <summary>
        /// copying a file to specific folder
        /// </summary>
        /// <param name="fileId"></param>
        /// <param name="toPath"></param>
        /// <returns></returns>
        [OperationContract]
        bool Copy(int fileId, int toFolderId);
        
        /// <summary>
        /// delete a file
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        [OperationContract]
        bool DeleteFile(int filename);

        /// <summary>
        /// get files
        /// </summary>
        /// <param name="folderId"></param>
        /// <returns></returns>
        [OperationContract]
        List<File> GetFiles(int folderId,int sortBy,bool isSortAscending,int pageSize,int pageIndex);
                
        /// <summary>
        /// create a folder
        /// </summary>
        /// <param name="objFolder"></param>
        /// <returns></returns>
        [OperationContract]
        int CreateFolder(Folder objFolder);
        
        /// <summary>
        /// change name of a folder 
        /// </summary>
        /// <param name="folderId">int folderId</param>
        /// <param name="newFolderName">string new foldername</param>
        /// <returns></returns>
        [OperationContract]
        bool ChangeName(int folderId, string newFolderName);
        
        /// <summary>
        /// delete a folder 
        /// </summary>
        /// <param name="folderId">int</param>
        /// <returns></returns>
        [OperationContract]
        bool DeleteFolder(int folderId);

        [OperationContract]
        /// <summary>
        /// get folder
        /// </summary>
        /// <param name="folderId"></param>
        /// <returns></returns>        
        Folder GetFolder(int folderId);

        /// <summary>
        /// get folders
        /// </summary>
        /// <param name="parentId">int</param>
        /// <param name="owner">string</param>
        /// <returns></returns>
        [OperationContract]
        List<Folder> GetFolders(int parentId, string owner,int sortBy,bool isSortAscending,int pageSize,int pageIndex);


        [OperationContract]
        int CreateUser(User obj);

        [OperationContract]
        List<User> GetUsers();

        [OperationContract]
        List<System.IO.DirectoryInfo> GetPhysicalFolders(int parentId);                
        
        
    }
}
